package com.xilihui.xlh.business.requests;

import com.xilihui.xlh.business.entities.AreaEntity;
import com.xilihui.xlh.business.entities.ShareEntity;
import com.xilihui.xlh.business.entities.UploadingEntity;
import com.xilihui.xlh.core.app.BaseEntity;
import com.xilihui.xlh.core.util.SPUtil;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import retrofit2.http.Streaming;
import retrofit2.http.Url;
import rx.Observable;

/**
 * Created by Administrator on 2018/6/28.
 */

public interface SignedService {

    /**
     * 上传商品一张图片
     *
     * @return
     */
    @Multipart
    @POST("/api/user/uplod_img")
    Observable<UploadingEntity> uploadImg(
            @Part("img\"; filename=\"image.jpg\"") RequestBody imgs1,
            @Query("access_token") String access_token
    );
    
    //签约申请-提交
    @FormUrlEncoded
    @POST("api/user/contract_application")
    Observable<BaseEntity> submit(
            @Query("access_token") String access_token,
            @Field("head_pic") String head_pic,
            @Field("real_name") String real_name,
            @Field("sex") String sex,
            @Field("birthday") String birthday,
            @Field("working_age") String working_age,
            @Field("province") String province,
            @Field("city") String city,
            @Field("district") String district,
            @Field("idcard") String idcard,
            @Field("idcard_img_hand") String idcard_img_hand,
            @Field("idcard_img_back") String idcard_img_back,
            @Field("idcard_img_front") String idcard_img_front
    );
    
    //获取地址
    @GET("api/user/get_all_reagion")
    Observable<AreaEntity> getAddress(
            @Query("access_token") String access_token
    );
    
    //判断是否提交申请
    @GET("api/user/contract_application")
    Observable<BaseEntity> isApply(
            @Query("access_token") String access_token
    );
    
    @FormUrlEncoded
    @POST("/api/index/get_qrcode")
    Observable<ShareEntity> weixinQrCode(
        @Field("access_token") String access_token      
    );


    // 下载文件
    @Streaming
    @GET
    Observable<ResponseBody> downloadImages(@Url String url);
    
}
